package com.huike.dao;

import com.huike.po.p2pMessage;
import com.huike.pojo.FileMsg;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
@Mapper
/**
 * 与个人会话相关的操作
 */
public interface P2pDAO {
    List<p2pMessage> selectAllP2PChatRecordByUser (@Param("accountFirst")String accountFirst,@Param("accountSecond")String accountSecond);
    p2pMessage selectP2PLastMsg (@Param("accountFirst")String accountFirst,@Param("accountSecond")String accountSecond);
    p2pMessage selectP2PMsgById(@Param("userChatId")int userChatId);
    // 插入一条p2p聊天记录
    void insertP2PChatRecord (p2pMessage message);
    // 根据好友账号,删除发送给自己的离线p2p记录
    void deleteOfflineP2PRecord (@Param("accountFrom")String accountFrom, @Param("accountTo")String accountTo);
    // p2p漫游记录查询
    List<p2pMessage> selectAllP2PRoamingRecordByUser (@Param("accountFirst")String accountFirst,@Param("accountSecond")String accountSecond);
    //根据消息发送方和接收方账号确定黑名单关系
    public int selectIsBlackedByAccountAndFriendAccount(p2pMessage p2pMessage);

    public void insertFileRecord(FileMsg message);

    public List<FileMsg> selectFileRecord(@Param("msgFrom") String msgFrom, @Param("msgTo") String msgTo);

    public List<FileMsg> selectFileByFileName(@Param("msgFrom") String msgFrom, @Param("msgTo") String msgTo, @Param("fileName") String fileName);
}
